import requests

header = {'Content-Type': 'application/x-www-form-urlencoded',
          'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'}
param = {'name': 'admin', 'password': 'password', 'verifyCode': ''}
req = requests.post('http://localhost/TinyShop17/index.php?con=admin&act=check', data=param, allow_redirects=False)
code = req.status_code
cookie = req.cookies
print(cookie['PHPSESSID'])
print(code)
print(req.history)
print(req.text)

# 很奇怪, tinyshop用代码来实现的话, 验证码带上就会登陆不成功.不带验证码就登陆成功了.
# requests会自动处理重定向的请求
